#ifndef _LPBC_TEST_H_
#define _LPBC_TEST_H_

// this code come from prorobuf-lc, not edit!
#include "lib_pbc.h"

/*
message test{
	int32 a=1;
	int32 b=2;
	int32 c=3;

  repeated int32 d=4;

  message info{
	int32 i1=1;
	int32 i2=2;
  }

  repeated info io=5;
}
*/

typedef struct _info{
	int32_t i1;
	int32_t i2;
}info;

typedef struct _test{
	int32_t _a;
	int32_t _b;
	int32_t _c;

	pbc_list _d;
	pbc_list _io;
}test;

// info message
info* newM_info();
size_t infoM_parse(info* m_p, uint8_t* in, size_t len);
size_t infoM_serial(info* m_p, uint8_t* out);
void freeM_info(info* m_p);

// test message
test* newM_test();
// get set test d
#define testM_d_add(p)		(int32_t*)add_pbc_list( &((p)->_d))
#define testM_d_count(p)	(int)count_pbc_list(&((p)->_d))
// get set test io
#define testM_io_add(p)		( (info*)add_pbc_list( &((p)->_io)) ) 
#define testM_io_count(p)	( (int)count_pbc_list(&((p)->_io)) )
size_t testM_parse(test* m_p, uint8_t* in, size_t len);
size_t testM_serial(test* m_p, uint8_t* out);
void freeM_test(test* m_p);

#endif